package archsw0904.controller.registration;

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import archsw0904.model.ProfileAdmin;
import archsw0904.model.ProfileUser;


public @Stateless class ProfileAdminBean implements ProfileAdminBeanLocal {

	@PersistenceContext
	EntityManager em;
	
	public ProfileUser findAdminByLogin(String loginId) {
		return ( (ProfileAdmin) em.find(ProfileAdmin.class, loginId) ) ;
	}	
	
	public void createProfileAdmin (String loginId, String password, String name, String surname, String email ) {
		
		ProfileAdmin profile = new ProfileAdmin() ;
		
		profile.setLoginId(loginId) ;
		profile.setPassword(password) ;
		profile.setName(name) ;
		profile.setSurname(surname) ;
		profile.setEmail(email) ;
		
		em.persist(profile);
		
	}

	
}
